<template>
  <router-view />
</template>

<script lang="ts" setup>

// 直接从浏览器URL进入后 同样也添加到tabs中
import { useStore } from 'vuex';
import { useRoute } from 'vue-router';
import { watch } from 'vue';
const store = useStore();
const route = useRoute();
watch(route, (to, from) => {
  if (to.path !== '/login') {
    const obj = {
      name: to.name,
      title: to.meta.title
    }
    store.commit('addTab', obj);
  }
})

</script>

<!-- 全局样式控制 -->

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* text-align: center; */
  color: #2c3e50;
}

nav {
  padding: 30px;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
